package com.gao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author: suGar
 * @Date: 2022/11/11 14:10
 */
@RestController
@RequestMapping("order")
public class OrderController {

    public static final String PAYMENT_URL = "http://cloud-provider-payment/";

    RestTemplate restTemplate;
    @Autowired
    public OrderController(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @GetMapping
    public String getOrder() {
        return restTemplate.getForObject(PAYMENT_URL + "payment", String.class);
    }
}
